
package com.jf.cloud.user.service.impl;


import com.jf.cloud.api.user.vo.UserManagerVO;
import com.jf.cloud.common.database.dto.PageDTO;
import com.jf.cloud.common.database.util.PageUtil;
import com.jf.cloud.common.database.vo.PageVO;
import com.jf.cloud.user.dto.ShopCustomerDTO;
import com.jf.cloud.user.mapper.ShopCustomerMapper;
import com.jf.cloud.user.model.ShopCustomer;
import com.jf.cloud.user.service.ShopCustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * 
 *
 * @author zz
 * @date 2023-01-15 15:53:16
 */
@Service
public class ShopCustomerServiceImpl implements ShopCustomerService {

    @Autowired
    private ShopCustomerMapper shopCustomerMapper;

    @Override
    public PageVO<ShopCustomer> page(PageDTO pageDTO) {
        return PageUtil.doPage(pageDTO, () -> shopCustomerMapper.list());
    }

    @Override
    public ShopCustomer getByShopCustomerId(Long shopCustomerId) {
        return shopCustomerMapper.getByShopCustomerId(shopCustomerId);
    }

    @Override
    public void save(ShopCustomer shopCustomer) {
        shopCustomerMapper.save(shopCustomer);
    }

    @Override
    public void update(ShopCustomer shopCustomer) {
        shopCustomerMapper.update(shopCustomer);
    }

    @Override
    public void deleteById(Long shopCustomerId) {
        shopCustomerMapper.deleteById(shopCustomerId);
    }

    @Override
    public PageVO<UserManagerVO> pageShopCustomerByParam(PageDTO pageDTO, ShopCustomerDTO shopCustomerDTO) {
        return PageUtil.doPage(pageDTO, ()->shopCustomerMapper.listByParam(shopCustomerDTO));

    }

    @Override
    public void saveBatch(List<ShopCustomer> shopCustomers) {
        shopCustomerMapper.saveBatch(shopCustomers);
    }

    @Override
    public List<ShopCustomer> listByUserId(Long userId) {
        return shopCustomerMapper.listByUserId(userId);
    }

    @Override
    public List<UserManagerVO> listByParam(ShopCustomerDTO shopCustomerDTO) {
        return shopCustomerMapper.listByParam(shopCustomerDTO);
    }

    @Override
    public List<Long> getShopCustomerIdsByShopId(Long shopId) {
        return shopCustomerMapper.getShopCustomerIdsByShopId(shopId);
    }
}
